package com.wayhome.srpingbootmybatis.test.entity.boc;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import java.util.ArrayList;
import java.util.List;

@Data
public class BocRefundOrderDTO implements IBocRequest {

    //商户号
    @ApiModelProperty(value = "商户号")
    private String merchantNo;

    //商户退款交易流水号
    @ApiModelProperty(value = "商户退款交易流水号")
    private String mRefundSeq;

    //退款币种
    @ApiModelProperty(value = "退款币种")
    private String curCode;

    //退款金额 格式：整数位不前补零,小数位补齐2位 即：不超过10位整数位+1位小数点+2位小数
    @ApiModelProperty(value = "退款金额 格式：整数位不前补零,小数位补齐2位 即：不超过10位整数位+1位小数点+2位小数")
    private String refundAmount;

    //商户订单号
    @ApiModelProperty(value = "商户订单号")
    private String orderNo;

    //商户签名数据
    @ApiModelProperty(value = "商户签名数据")
    private String signData;

    public String genPlainText() {
        return merchantNo + "|" +
                mRefundSeq + "|" +
                curCode + "|" +
                refundAmount + "|" +
                orderNo;
    }

    public List<NameValuePair> genHttpParam() {
        List<NameValuePair> formParams = new ArrayList<NameValuePair>();
        formParams.add(new BasicNameValuePair("merchantNo", merchantNo));
        formParams.add(new BasicNameValuePair("mRefundSeq", mRefundSeq));
        formParams.add(new BasicNameValuePair("curCode", curCode));
        formParams.add(new BasicNameValuePair("refundAmount", refundAmount));
        formParams.add(new BasicNameValuePair("orderNo", orderNo));
        formParams.add(new BasicNameValuePair("signData", signData));
        return formParams;
    }
}
